package org.ouwa.lms.client.service;

import org.ouwa.lms.client.model.Account;
import org.ouwa.lms.client.model.Authentication;
import com.google.gwt.user.client.rpc.AsyncCallback;

public interface RemoteAccountServiceAsync {
	/**
     * Creates a new account based on the given account.
     *
     * @param account The account to create.
     * @param callback Will be called with the newly created account.
     */
    void createAccount(Account account, AsyncCallback<Account> callback);
    
    /**
     * Logs in to the application based on the given authentication. On successful login the authentication will be
     * registered with this manager as the currently logged in user.
     *
     * @param authentication Holds the authentication information for the login.
     * @param callback On a successful login, called with the account associated with he given authentication.
     */
    void login(Authentication authentication, AsyncCallback<Account> callback);
    
    /**
     * Logs out the currently authenticated user.
     */
    void logout(AsyncCallback<Authentication> callback);
    
    /**
     * Returns the currently logged in authentication.
     *
     */
    void getCurrentAuthentication(AsyncCallback<Authentication> callback);
    
    /**
     * Removes an existing account based on the given account.
     * 
     * @param account The given existing account
     * @param callback Will be called with the removed account's name
     */
    void removeAccount(Authentication auth, AsyncCallback<Account> callback);
    
    /**
     * Updates an existing account based on the given account.
     * 
     * @param account The given existing account
     * @param callback Will be called with the updated account's name
     */
    void updateAccount(Account account, AsyncCallback<Account> callback);
    
    /**
     * Retrieves an account via the login email address.
     * 
     * @param email The given login email
     */
	void getAccount(String email, AsyncCallback<Account> callback);
}
